package main.Q2601_2700;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Q2671_2680 {
	public static void main(String[] args) {
		System.out.println("Question2671：");
		System.out.println("Question2672：");
		System.out.println("Question2673：");
		System.out.println("Question2674：");
		System.out.println("Question2675：");
		System.out.println("Question2676：");
		System.out.println("Question2677：");
		System.out.println("Question2678：老人的数目");
		System.out.println("Question2679：矩阵中的和");
		System.out.println("Question2680：");
	}
}

class Question2678 {
	public int countSeniors(String[] details) {
		int count = 0;
		for (String detail : details) {
			String age = detail.substring(11, 13);
			if (Integer.valueOf(age) > 60) count++;
		}
		return count;
	}
}

class Question2679 {
	public int matrixSum(int[][] nums) {
		int result = 0;
		List<List<Integer>> arr = new ArrayList<>();
		for (int[] row : nums) {
			List<Integer> list = new ArrayList<>();
			for (int num : row) {
				list.add(num);
			}
			Collections.sort(list);
			arr.add(list);
		}
		for (int i = 0; i < nums[0].length; i++) {
			int max = Integer.MIN_VALUE;
			for (int j = 0; j < arr.size(); j++) {
				List<Integer> temp = arr.get(j);
				Integer cur = temp.get(temp.size() - 1);
				max = Math.max(max, cur);
				temp.remove(temp.size() - 1);
			}
			result += max;
		}
		return result;
	}
}